﻿@model Epi.Web.MVC.Models.OrgListModel
@{
    ViewBag.Title = "Epi Info™ Cloud Data Capture - Site Administration";// + " - "+ 
	// Model.SurveyName + " - " + Model.IsDraftModeStyleClass;
	Layout = "~/Views/Shared/_Layout.cshtml";
}
 <link href="@Url.Content("~/Content/css/eweAdmin.css")" rel="Stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $("div#demoheader").css({ "margin": "-2px 0px 0px 10px" });
    });
    </script>
<div id="pageHeader">
	<div id="pageTitleAdmin">
		<h2 class="adminnav">@Html.ActionLink("Organizations", "OrgList", "AdminOrganization", null, new { @class = "orgbtn" })</h2>

        <span>&nbsp;&nbsp;</span>
		<h2 class="adminnav">@Html.ActionLink("Users", "UserList", "AdminUser", null, new { @class = "userbtn" })</h2>

	</div>


	<div id="userwelcome">
		Welcome <strong>@Session["UserFirstName"] @Session["UserLastName"]</strong>&nbsp; | &nbsp;
	  @*  <a href="#">Log Out</a>*@

	  @Html.ActionLink("Home", "Index", "Home", null, null) @if (@System.Configuration.ConfigurationManager.AppSettings["WINDOW_AUTHENTICATION"].ToUpper() == "NO")
        { 
	         <span>&nbsp; | &nbsp;</span> 	
        }
@if (@System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"] != null)
{
    if (@System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"].ToUpper() == "TRUE")
    {
        <a href="http://www.cdc.gov/epiinfo/cloud/index.html">Log Out</a>

    }
    else
    {
        if (@System.Configuration.ConfigurationManager.AppSettings["WINDOW_AUTHENTICATION"].ToUpper() == "NO")
        {
            @Html.ActionLink("Log Out", "LogOut", "Home", null, null)
        }
    }
}
	</div>
	<div style="clear: both;"></div>
</div>

<div id="content" style="margin:15px 0px 0px 0px; padding-left: 10px; min-height: 375px;">

    <div id="formtitleadmin" style="display:block; margin-bottom:25px">
        <h2 class="surveyTitle">Manage Organizations</h2>
    </div>
    <div style="clear:both;"></div>

    <div class="datagrid">
    @if (!string.IsNullOrEmpty(Model.Message))
    {
          <div id="success" >
           <span>@Model.Message</span>
          </div>
    }
    <div style="clear:both;"></div>

    <div id="adminpaging">
		<div>
			@*@Html.ActionLink("Add New Organization","OrgInfo","AdminOrganization")*@
            @if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"] == null)
            {
                @Html.ActionLink("Add New Organization", "OrgInfo", "AdminOrganization", new { orgkey = -1, iseditmode = false }, null)
            }
            @if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"] != null)
            {
                if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"].ToUpper() == "FALSE")
                {
                    @Html.ActionLink("Add New Organization", "OrgInfo", "AdminOrganization", new { orgkey = -1, iseditmode = false }, null)
                }
                else if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"].ToUpper() == "TRUE")
                {
                    // @Html.ActionLink("Add New Organization", "OrgInfo", "AdminOrganization", new { onclick = "javascript:return false;" })
                    @Html.ActionLink("Add New Organization", "OrgInfo", "AdminOrganization", new { orgkey = -1, iseditmode = false }, new { Class = "action", title = "Add a new organisation." })
                }
            }
		</div>
		@*<div style="float:right;">
			<a href="#"><span>Previous</span></a>
			<span>1 - 20 of 40</span></a>
			<a href="#"><span>Next</span></a>
		</div>*@
        <div style="clear:both;"></div>
	</div>


	    <table class="sortable">

		<thead>
			<tr>
				<th>Organization</th>
				<th>Org Key</th>
				<th>Active</th>
				<th>Actions</th>
			</tr>
		</thead>

		<tbody>
        @foreach (var item in Model.OrganizationList)
        {
			<tr>
				<td>@item.Organization</td>
				<td>@item.OrganizationKey</td>
				<td>@item.IsEnabled</td>
                <td><span >
              @if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"] == null)
              {
                @Html.ActionLink("Edit", "OrgInfo", "AdminOrganization", new { orgkey = item.OrganizationKey, iseditmode = true }, null)
              }
            @if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"] != null)
            {
                if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"].ToUpper() == "FALSE")
                {
                    @Html.ActionLink("Edit", "OrgInfo", "AdminOrganization", new { orgkey = item.OrganizationKey, iseditmode = true }, null)
                }
                else if (System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"].ToUpper() == "TRUE")
                {
                    // @Html.ActionLink("Edit", "OrgInfo", "AdminOrganization", new { onclick = "javascript:return false;" })
                    @Html.ActionLink("Edit", "OrgInfo", "AdminOrganization", new { orgkey = item.OrganizationKey, iseditmode = true }, new { Class = "action", title = "Modify or change an existing user's information and organisation details." })
                }
            }
                </span>

                </td>
			</tr>
            }

		</tbody>
	</table>

    <div style="clear:both; visibility:collapse;"></div>
</div><!--End Content Div-->
@*
@Html.ActionLink("Add Org","OrgInfo","Admin")*@
